<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 7.2.0">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/ME.ico">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/ME.ico">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/ME.ico">
  <link rel="mask-icon" href="/images/ME.ico" color="#222">

<link rel="stylesheet" href="/css/main.css">


<link rel="stylesheet" href="/lib/font-awesome/css/all.min.css">

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"www.zhoubencheng.com","root":"/","scheme":"Pisces","version":"7.8.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":false,"show_result":true,"style":"mac"},"back2top":{"enable":true,"sidebar":false,"scrollpercent":true},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":false,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}}};
  </script>

  <meta name="description" content="introduction 简单的常微分方程求解问题通式，我们的问题是从这个方程组入手，得到y关于x的函数关系，但是解析解一般难以求解，因此从数值解求法入手 \[ \begin{cases} \frac{dy}{dx} &#x3D; f(x, y) &amp;x \in [a, b]\\ y(a) &#x3D; y_0 \end{cases} \] \(Lipschitz条件: |f(x, y_1) - f(x, y_">
<meta property="og:type" content="article">
<meta property="og:title" content="常微分方程数值解法">
<meta property="og:url" content="http://www.zhoubencheng.com/2024/04/20/%E5%B8%B8%E5%BE%AE%E5%88%86%E6%96%B9%E7%A8%8B%E6%95%B0%E5%80%BC%E8%A7%A3%E6%B3%95/index.html">
<meta property="og:site_name" content="Benson&#39;s blog">
<meta property="og:description" content="introduction 简单的常微分方程求解问题通式，我们的问题是从这个方程组入手，得到y关于x的函数关系，但是解析解一般难以求解，因此从数值解求法入手 \[ \begin{cases} \frac{dy}{dx} &#x3D; f(x, y) &amp;x \in [a, b]\\ y(a) &#x3D; y_0 \end{cases} \] \(Lipschitz条件: |f(x, y_1) - f(x, y_">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://i.postimg.cc/mgLRtKM4/Euler-Method.png">
<meta property="og:image" content="https://i.postimg.cc/yN5zpdG6/convergence.jpg">
<meta property="article:published_time" content="2024-04-20T09:15:25.000Z">
<meta property="article:modified_time" content="2024-07-05T07:07:53.954Z">
<meta property="article:author" content="Benson">
<meta property="article:tag" content="数值计算">
<meta property="article:tag" content="高等数学">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://i.postimg.cc/mgLRtKM4/Euler-Method.png">

<link rel="canonical" href="http://www.zhoubencheng.com/2024/04/20/%E5%B8%B8%E5%BE%AE%E5%88%86%E6%96%B9%E7%A8%8B%E6%95%B0%E5%80%BC%E8%A7%A3%E6%B3%95/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'zh-CN'
  };
</script>

  <title>常微分方程数值解法 | Benson's blog</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>


<style>.github-emoji { position: relative; display: inline-block; width: 1.2em; min-height: 1.2em; overflow: hidden; vertical-align: top; color: transparent; }  .github-emoji > span { position: relative; z-index: 10; }  .github-emoji img, .github-emoji .fancybox { margin: 0 !important; padding: 0 !important; border: none !important; outline: none !important; text-decoration: none !important; user-select: none !important; cursor: auto !important; }  .github-emoji img { height: 1.2em !important; width: 1.2em !important; position: absolute !important; left: 50% !important; top: 50% !important; transform: translate(-50%, -50%) !important; user-select: none !important; cursor: auto !important; } .github-emoji-fallback { color: inherit; } .github-emoji-fallback img { opacity: 0 !important; }</style>
</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <h1 class="site-title">Benson's blog</h1>
      <span class="logo-line-after"><i></i></span>
    </a>
      <p class="site-subtitle" itemprop="description">最好的安排</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
    </div>
  </div>
</div>




<nav class="site-nav">
  <ul id="menu" class="main-menu menu">
        <li class="menu-item menu-item-home">

    <a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签</a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档</a>

  </li>
  </ul>
</nav>




</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>

  <a href="https://github.com/ZhouBencheng" class="github-corner" title="Follow me on GitHub" aria-label="Follow me on GitHub" rel="noopener" target="_blank"><svg width="80" height="80" viewBox="0 0 250 250" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></a>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content post posts-expand">
            

    
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="http://www.zhoubencheng.com/2024/04/20/%E5%B8%B8%E5%BE%AE%E5%88%86%E6%96%B9%E7%A8%8B%E6%95%B0%E5%80%BC%E8%A7%A3%E6%B3%95/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/ME.ico">
      <meta itemprop="name" content="Benson">
      <meta itemprop="description" content="Share my thoughts with you">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Benson's blog">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          常微分方程数值解法
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2024-04-20 17:15:25" itemprop="dateCreated datePublished" datetime="2024-04-20T17:15:25+08:00">2024-04-20</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2024-07-05 15:07:53" itemprop="dateModified" datetime="2024-07-05T15:07:53+08:00">2024-07-05</time>
              </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/USTB-courses/" itemprop="url" rel="index"><span itemprop="name">USTB courses</span></a>
                </span>
            </span>

          
            <span class="post-meta-item" title="阅读次数" id="busuanzi_container_page_pv" style="display: none;">
              <span class="post-meta-item-icon">
                <i class="fa fa-eye"></i>
              </span>
              <span class="post-meta-item-text">阅读次数：</span>
              <span id="busuanzi_value_page_pv"></span>
            </span>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <h2 id="introduction">introduction</h2>
<p>简单的常微分方程求解问题通式，我们的问题是从这个方程组入手，得到<code>y</code>关于<code>x</code>的函数关系，但是解析解一般难以求解，因此从数值解求法入手
<span class="math display">\[
\begin{cases}
\frac{dy}{dx} = f(x, y) &amp;x \in [a, b]\\
y(a) = y_0
\end{cases}
\]</span> <span class="math inline">\(Lipschitz条件: |f(x, y_1) - f(x,
y_2)| \leq L|y_1 - y_0|， x \in [a, b]\)</span>
当方程组中二元函数关系<code>f</code>满足该条件时，常微分方程有解</p>
<blockquote>
<p><code>Lipschitz</code>条件可以理解为：在任意x属于[a.
b]的闭区间中，<code>f(x. y)</code>的任意一条纵向曲线都是<strong>导数有界</strong></p>
</blockquote>
<span id="more"></span>
<h2 id="euler方法">Euler方法</h2>
<p>从三个角度理解欧拉方法的公式由来</p>
<ol type="1">
<li><p>差商近似导数 <span class="math display">\[
\frac{f(x_{n+1}) - f(x_{n})}{x_{n+1} - x_n} = f(x_n, y_n) \\
\Rightarrow f(x_{n+1}) = f(x_n) + hf(x_n, y_n)
\]</span></p></li>
<li><p>数值积分方法 <span class="math display">\[
f(x_{n+1}) = f(x_n) + \int_{x_n}^{x_{n+1}}f(x, y)dx \\
使用积分矩形近似 \Rightarrow f(x_{n+1}) = f(x_n) + hf(x_n, y_n)
\]</span></p></li>
<li><p>Taylor展开方法 <span class="math display">\[
f(x_{n+1}) = f(x_n) + hf(x_n, y_n) \\
仅使用泰勒展开到一阶导数的程度来近似
\]</span></p></li>
</ol>
<p><img src="https://i.postimg.cc/mgLRtKM4/Euler-Method.png" style="zoom:33%;"></p>
<p>可以看出Euler方法会造成误差累积，拟合程度较差</p>
<h2 id="改进euler方法">改进Euler方法</h2>
<h3 id="改进euler公式">改进Euler公式</h3>
<p>改进Euler方法的特点在于使用两个端点的导数平均值作为延伸斜率，公式如下
<span class="math display">\[
\begin{cases}
\overline{y_{i + 1}} = y_i + h*f(x_i, y_i) \\
y_{i + 1} = y_i + \frac{h}{2} * [f(x_i, y_i) + f(x_{i + 1},
\overline{y_{i + 1}})]
\end{cases}
\]</span> 公式中可以看出先使用Euler公式初步推算出 <span class="math inline">\(y_{i +
1}\)</span>的值，再使用这个值在<strong>梯形公式</strong>中代出真正的<span class="math inline">\(y_{i + 1}\)</span></p>
<blockquote>
<p>另外一种改进Euler方法的写法如下，该种公式呈现形式用于方便计算机编程
<span class="math display">\[
\begin{cases}
y_p = y_i + h*f(x_i, y_i) \\
y_q = y_i + h*f(x_{i + 1}, y_p) \\
y_{i + 1} = \frac{(y_p + y_q)}{2}
\end{cases}
\]</span></p>
</blockquote>
<h3 id="收敛阶的概念">收敛阶的概念</h3>
<blockquote>
<p>整体截断误差：<span class="math inline">\(e_i = y(x_i) -
y_i\)</span>，对于某一个数值计算方法，计算出每一个点上精确值和估算值的差值，称为整体截断误差，但这种方法一般都非常麻烦</p>
<p>局部阶段误差：<span class="math inline">\(R_{i+1} = y(i+1) - y_{i +
1}\)</span>，$y_{i + 1} <span class="math inline">\(的运算结果建立在\)</span>y(x_i) = y_i<span class="math inline">\(的基础上，得到的\)</span>R_{i+1}$误差值称为局部截断误差</p>
</blockquote>
<p><strong>收敛阶定义</strong>：如果一个数值方法的局部截断误差是<span class="math inline">\(O(h^{p + 1})\)</span>，那么该方法是p阶的</p>
<p><strong>改进Euler方法的收敛阶分析</strong>：根据泰勒公式展开，得到收敛阶为2</p>
<p><img src="https://i.postimg.cc/yN5zpdG6/convergence.jpg" style="zoom: 25%;"></p>
<h2 id="runge-kutta方法">Runge-Kutta方法</h2>
<p>为了应对开始题目，先提出重要的经典四阶龙格库塔方法 <span class="math display">\[
\begin{cases}
y_{ i + 1 } = y_i + {h \over 6} * (K_1 + 2K_2 + 2K_3 + k_4)\\
K_1 = f(x_i, y_i)\\
K_2 = f(x_i + {h \over 2}, y_i + {h \over 2}K_1)\\
K_3 = f(x_i + {h \over 2}, y_i + {h \over 2}K_2)\\
K_4 = f(x_i + h, y_i + hK_4)
\end{cases}
\]</span></p>

    </div>

    
    
    

      <footer class="post-footer">
          
          <div class="post-tags">
              <a href="/tags/%E6%95%B0%E5%80%BC%E8%AE%A1%E7%AE%97/" rel="tag"><i class="fa fa-tag"></i> 数值计算</a>
              <a href="/tags/%E9%AB%98%E7%AD%89%E6%95%B0%E5%AD%A6/" rel="tag"><i class="fa fa-tag"></i> 高等数学</a>
          </div>

        


        
    <div class="post-nav">
      <div class="post-nav-item">
    <a href="/2023/11/27/%E7%BE%A4%E8%AE%BA%E5%A4%8D%E4%B9%A0/" rel="prev" title="群论复习">
      <i class="fa fa-chevron-left"></i> 群论复习
    </a></div>
      <div class="post-nav-item">
    <a href="/2024/04/23/%E6%8F%92%E5%80%BC%E4%B8%8E%E6%8B%9F%E5%90%88/" rel="next" title="插值与拟合">
      插值与拟合 <i class="fa fa-chevron-right"></i>
    </a></div>
    </div>
      </footer>
    
  </article>
  
  
  



          </div>
          

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#introduction"><span class="nav-number">1.</span> <span class="nav-text">introduction</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#euler%E6%96%B9%E6%B3%95"><span class="nav-number">2.</span> <span class="nav-text">Euler方法</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E6%94%B9%E8%BF%9Beuler%E6%96%B9%E6%B3%95"><span class="nav-number">3.</span> <span class="nav-text">改进Euler方法</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#%E6%94%B9%E8%BF%9Beuler%E5%85%AC%E5%BC%8F"><span class="nav-number">3.1.</span> <span class="nav-text">改进Euler公式</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E6%94%B6%E6%95%9B%E9%98%B6%E7%9A%84%E6%A6%82%E5%BF%B5"><span class="nav-number">3.2.</span> <span class="nav-text">收敛阶的概念</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#runge-kutta%E6%96%B9%E6%B3%95"><span class="nav-number">4.</span> <span class="nav-text">Runge-Kutta方法</span></a></li></ol></div>
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="Benson"
      src="/images/ME.ico">
  <p class="site-author-name" itemprop="name">Benson</p>
  <div class="site-description" itemprop="description">Share my thoughts with you</div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">17</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/categories/">
          
        <span class="site-state-item-count">7</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/tags/">
          
        <span class="site-state-item-count">25</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>
  <div class="links-of-author motion-element">
      <span class="links-of-author-item">
        <a href="https://github.com/ZhouBencheng" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;ZhouBencheng" rel="noopener" target="_blank"><i class="fab fa-github fa-fw"></i>GitHub</a>
      </span>
      <span class="links-of-author-item">
        <a href="mailto:zhoubencheng2022@163.com" title="E-Mail → mailto:zhoubencheng2022@163.com" rel="noopener" target="_blank"><i class="fa fa-envelope fa-fw"></i>E-Mail</a>
      </span>
  </div>



      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2024</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Benson</span>
</div>

<!--
  <div class="powered-by">由 <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> & <a href="https://pisces.theme-next.org/" class="theme-link" rel="noopener" target="_blank">NexT.Pisces</a> 强力驱动
  </div>
-->

        
<div class="busuanzi-count">
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
    <span class="post-meta-item" id="busuanzi_container_site_uv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-user"></i>
      </span>
      <span class="site-uv" title="总访客量">
        <span id="busuanzi_value_site_uv"></span>
      </span>
    </span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item" id="busuanzi_container_site_pv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-eye"></i>
      </span>
      <span class="site-pv" title="总访问量">
        <span id="busuanzi_value_site_pv"></span>
      </span>
    </span>
</div>








      </div>
    </footer>
  </div>

  
  <script src="/lib/anime.min.js"></script>
  <script src="/lib/velocity/velocity.min.js"></script>
  <script src="/lib/velocity/velocity.ui.min.js"></script>

<script src="/js/utils.js"></script>

<script src="/js/motion.js"></script>


<script src="/js/schemes/pisces.js"></script>


<script src="/js/next-boot.js"></script>


  <script defer src="/lib/three/three.min.js"></script>
    <script defer src="/lib/three/canvas_lines.min.js"></script>


  













<script>
if (document.querySelectorAll('pre.mermaid').length) {
  NexT.utils.getScript('//cdn.jsdelivr.net/npm/mermaid@8/dist/mermaid.min.js', () => {
    mermaid.initialize({
      theme    : 'dark',
      logLevel : 3,
      flowchart: { curve     : 'linear' },
      gantt    : { axisFormat: '%m/%d/%Y' },
      sequence : { actorMargin: 50 }
    });
  }, window.mermaid);
}
</script>


  

  
      

<script>
  if (typeof MathJax === 'undefined') {
    window.MathJax = {
      loader: {
        source: {
          '[tex]/amsCd': '[tex]/amscd',
          '[tex]/AMScd': '[tex]/amscd'
        }
      },
      tex: {
        inlineMath: {'[+]': [['$', '$']]},
        tags: 'ams'
      },
      options: {
        renderActions: {
          findScript: [10, doc => {
            document.querySelectorAll('script[type^="math/tex"]').forEach(node => {
              const display = !!node.type.match(/; *mode=display/);
              const math = new doc.options.MathItem(node.textContent, doc.inputJax[0], display);
              const text = document.createTextNode('');
              node.parentNode.replaceChild(text, node);
              math.start = {node: text, delim: '', n: 0};
              math.end = {node: text, delim: '', n: 0};
              doc.math.push(math);
            });
          }, '', false],
          insertedScript: [200, () => {
            document.querySelectorAll('mjx-container').forEach(node => {
              let target = node.parentNode;
              if (target.nodeName.toLowerCase() === 'li') {
                target.parentNode.classList.add('has-jax');
              }
            });
          }, '', false]
        }
      }
    };
    (function () {
      var script = document.createElement('script');
      script.src = '//cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js';
      script.defer = true;
      document.head.appendChild(script);
    })();
  } else {
    MathJax.startup.document.state(0);
    MathJax.texReset();
    MathJax.typeset();
  }
</script>

    

  

</body>
</html>
